home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Deutsche Edition 1
/
Deutsche Edition 1.iso
/
amok
/
081-090
/
amok81
/
m2
/
talkdemo
/
txt
/
aslreq2.mod
< prev
next >
Wrap
Text File
|
1993-11-04
|
3KB
|
156 lines
IMPLEMENTATION MODULE ASLReq2;
(*$ LargeVars:=FALSE *)
FROM SYSTEM IMPORT ADR, ADDRESS,TAG,CAST;
FROM UtilityD IMPORT tagEnd,tagIgnore;
FROM String IMPORT Copy, LastPos, Length, Concat;
IMPORT d:AslD, l:AslL, DosD,DosL, ID:IntuitionD, A:Arts;
VAR
(*$ LongAlign:=TRUE *)
r:d.FileRequesterPtr;
buff:ARRAY[0..20] OF LONGINT;
File, Dir: ARRAY[0..127] OF CHAR;
(*$ RangeChk:=FALSE StackChk:=FALSE OverflowChk:=FALSE StackParms:=FALSE
Volatile:=FALSE
*)
(* Zerlege f in file und dir *)
PROCEDURE GetPath(VAR f,d:ARRAY OF CHAR);
VAR pos,i:INTEGER;
BEGIN
Copy(d,f);
pos:=LastPos(f,-1,'/');
IF pos<0 THEN
pos:=LastPos(f,-1,':');
END;
IF pos>=0 THEN
IF d[pos]=':' THEN d[pos+1]:=0C ELSE d[pos]:=0C END;
INC(pos);
FOR i:=pos TO Length(f) DO
f[i-pos]:=f[i]
END;
f[i]:=0C;
ELSE
d[0]:=0C
END;
END GetPath;
(*$ CopyDyn:=FALSE *)
PROCEDURE FileReq(
VAR FName:ARRAY OF CHAR;
Title,
Ext:ARRAY OF CHAR;
save:BOOLEAN
):BOOLEAN;
VAR
flags:d.FileReqFlagSet;
ok:BOOLEAN;
window:ID.WindowPtr;
pat:LONGCARD;
BEGIN
IF Ext[0]=0C THEN
pat:=tagIgnore
ELSE
pat:=ORD(d.aslPattern)
END;
window:=CAST(DosD.ProcessPtr,A.thisTask)^.windowPtr;
IF CAST(LONGINT,window)<0 THEN
RETURN FALSE
END;
Copy(File,FName);
GetPath(File,Dir);
IF (window#NIL)&(window^.userPort#NIL) THEN
flags:=d.FileReqFlagSet{d.filNewIDCMP}
ELSE
flags:=d.FileReqFlagSet{}
END;
IF save THEN
flags:=flags+d.FileReqFlagSet{d.filPatGad,d.filSave}
ELSE
flags:=flags+d.FileReqFlagSet{d.filPatGad}
END;
IF r=NIL THEN
r:=l.AllocAslRequest(d.aslFileRequest,TAG(buff,
d.aslPattern, ADR('#?'),
d.aslHeight, 200,
tagEnd));
END;
IF r#NIL THEN
ok:=l.AslRequest(r,TAG(buff,
d.aslHail, ADR(Title),
d.aslWindow, window,
pat, ADR(Ext),
d.aslDir, ADR(Dir),
d.aslFile, ADR(File),
d.aslFuncFlags, flags,
d.aslExtFlags1, d.Fil1FlagSet{},
tagEnd));
ELSE
ok:=FALSE;
END;
IF ok THEN
Copy(FName,r^.dir^);
IF ~DosL.AddPart(ADR(FName),r^.file,HIGH(FName)+1) THEN
ok:=FALSE
END;
END;
RETURN ok;
END FileReq;
(*$ CopyDyn:=FALSE *)
PROCEDURE DirReq(
VAR DName:ARRAY OF CHAR;
Title:ARRAY OF CHAR
):BOOLEAN;
VAR
flags:d.FileReqFlagSet;
ok:BOOLEAN;
window:ID.WindowPtr;
BEGIN
window:=CAST(DosD.ProcessPtr,A.thisTask)^.windowPtr;
IF CAST(LONGINT,window)<0 THEN
RETURN FALSE
END;
IF (window#NIL)&(window^.userPort#NIL) THEN
flags:=d.FileReqFlagSet{d.filNewIDCMP}
ELSE
flags:=d.FileReqFlagSet{}
END;
IF r=NIL THEN
r:=l.AllocAslRequest(d.aslFileRequest,TAG(buff,
d.aslPattern, ADR('#?'),
tagEnd));
END;
IF r#NIL THEN
ok:=l.AslRequest(r,TAG(buff,
d.aslHail, ADR(Title),
d.aslWindow, window,
d.aslDir, ADR(DName),
d.aslFuncFlags, flags,
d.aslExtFlags1, d.Fil1FlagSet{d.fil1NoFiles},
tagEnd));
ELSE
ok:=FALSE;
END;
IF ok THEN
Copy(DName,r^.dir^);
END;
RETURN ok;
END DirReq;
PROCEDURE FreeReq;
BEGIN
IF r#NIL THEN l.FreeAslRequest(r); r:=NIL END;
END FreeReq;
BEGIN
r:=NIL;
CLOSE
FreeReq;
END ASLReq2.mod